package com.wunong.smart.commission.service.impl;

import com.wunong.smart.commission.application.request.support.CancelCommissionRequest;
import com.wunong.smart.commission.application.request.support.CreateCommissionRequest;
import com.wunong.smart.commission.application.request.support.FinishCommissionRequest;
import com.wunong.smart.commission.client.param.CancelCommissionParam;
import com.wunong.smart.commission.client.param.CreateCommissionParam;
import com.wunong.smart.commission.client.param.FinishCommissionParam;
import com.wunong.smart.commission.client.service.CommissionWriteService;
import com.wunong.smart.commission.domain.service.CommissionDomainService;
import com.wunong.smart.domain.platform.rpc.Result;

import javax.annotation.Resource;

/**
 * @author create by zealot.zt
 */
public class CommissionWriteServiceImpl implements CommissionWriteService {

    @Resource
    protected CommissionDomainService commissionDomainService;

    @Override
    public Result<Long> create(CreateCommissionParam param) {
        return Result.create(commissionDomainService.create(CreateCommissionRequest.of(param)));
    }

    @Override
    public Result<Void> cancel(CancelCommissionParam param) {
        return Result.create(commissionDomainService.cancel(CancelCommissionRequest.of(param)));
    }

    @Override
    public Result<Void> finish(FinishCommissionParam param) {
        return Result.create(commissionDomainService.finish(FinishCommissionRequest.of(param)));
    }

}
